<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>resolve</title>
</head>
<body>
    <script>
        // 状态 成功
        const p1 = Promise.resolve(123);
        //如果传入的参数为非Promise类型的对象，则返回的结果为成功promise对象
        //如果传入的参数为 Promise对象，则参数的结果决定了resolve 的结果
        
        // 状态失败
        let p2 = Promise.resolve(new Promise((resolve,reject)=>{
            reject('error');
        }))

        console.log(p1);
        // catch方法 接收Promise失败的方法
        p2.catch(reason => {
            console.log(reason);
        })
    </script>
</body>
</html>